
clear
set more off

cap log close
log using "$logdir/match_rates.log", replace


use firm_id using $fromsasdir/owner_incm, clear
gduplicates drop firm_id, force
tempfile owners
qui save `owners'



use $fromsasdir/result if tp < 202112, clear

collapse entity govt, by(firm_id) fast // one observation per firm


merge 1:1 firm_id using `owners', keep(1 3)
gen matched = _merge == 3
drop _merge

*********************
*	Report the statistics of interest		*
*********************
sum matched
drop if govt
sum matched

bys entity: sum matched
tab entity

cap log close

